package com.bustle.ejb.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

@Entity
public class Lineitem
{
  public int getId()
  {
    return id;
  }

  public void setId(int anId)
  {
    id = anId;
  }

  public Product getProduct()
  {
    return product;
  }

  public void setProduct(Product aProduct)
  {
    product = aProduct;
  }

  public int getQuantity()
  {
    return quantity;
  }

  public void setQuantity(int aQuantity)
  {
    quantity = aQuantity;
  }

  public double getTotal()
  {
    return product.getPrice() * quantity;
  }

  @Id
  @GeneratedValue
  private int id;
  @ManyToOne
  private Product product;
  private int quantity;
}